package com.hyy.controller;

import com.hyy.bean.MaskUser;
import com.hyy.service.CartService;
import com.hyy.service.serviceImpl.CartServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "CartAddOneServlet",urlPatterns = "/addone")
public class CartAddOneServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req,resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		Long uid = Long.valueOf(req.getParameter("uid"));
		Long mid = Long.valueOf(req.getParameter("mid"));
		CartService cartService = new CartServiceImpl();

		cartService.deleteMyCart(uid,mid);
		resp.sendRedirect("/myCart");
	}
}
